<?php
set_time_limit(0);
if (isset($_POST['op']) && isset($_POST['yi'])){
    include '../c/config.php';
    $openid=trim($_POST['op']);
    $phone=trim(addslashes($_POST['phone']));
    $leftTime=trim(addslashes($_POST['leftTime']));
    $nianji=trim(addslashes($_POST['nianji']));

    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);

    if(6 == $nianji || 7 == $nianji){
        $table="d6";
    }else{
        $table="d9";
    }
     
    $mysqli->query("INSERT INTO `".$table."` (`id`, `uid`, `phone`,`yi`,`createtime`,`lefttime`) VALUES (NULL,'".$openid."','".$phone."', '".json_encode($_POST['yi'], JSON_UNESCAPED_UNICODE)."','".date("Y-m-d H:i:s")."','".$leftTime."')");
    
  
    $mysqli->close();

    echo json_encode(array('s'=>'y'));
}else{
    echo json_encode(array('s'=>'n'));
}

?>